<%--
 *  File:    ConditionDetailAdd.jsp
 *  @Author: Hilldao
 *  Date:    2002/1/8
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%
  //init param
  Category cat = Category.getInstance("jsp.ConditionDetailAdd");
  String strModuleName = "PCM";
  String privilegeCode = "Z0610,L205";
%>



<%
  HashMap userInfo = (HashMap)session.getAttribute("userinfo");
 

%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="conditiondetailadd"/>
<%@ include file="/inc/InitEdit.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<%@ include file="/inc/SummaryDivision.inc" %>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script>
function page_done()
{
  if(!checkpass(condetailaddform))
    return;
	document.condetailaddform.actionname.value = "done";
	document.condetailaddform.submit();
}
function checkpass(myform)
{
  if(isEmpty(myform.sortno.value))
  {
    alert('<%=message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Sequence",false)) %>');
    return false;
  }
  if(!isNumber(myform.sortno.value))
  {
    alert('<%=message.getMessageDesc("VALUE_MUST_BE_NUMBER",label.getLabelName("L_Sequence",false)) %>');
    return false;
  }
  if(isEmpty(myform.value0.value))
  {
    alert('<%=message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Value",false))%>');
    return false;
  }
  var str = myform.fieldnamealias.value;
  var arr = str.split("^");
  myform.fieldname.value = arr[0];
  if(isEmpty(myform.fieldname.value))
  {
    alert('<%=message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_FieldName",false)) %>');
    return false;
  }
  if(arr[1] == "date" || arr[1] == "Date")
  {
    var dd = dateCheck(myform.value0.value,"yyyy-MM-dd","<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>");
    if(dd <= 0)
    {
      alert('<%=message.getMessageDesc("VALUE_MUST_BE_DATE",label.getLabelName("L_Value",false)) %>');
      return;
    }
    else
      myform.value.value = dd;
  }
  else
    myform.value.value = myform.value0.value;
  return true;
}
</script>
</head>

<body>
<%
  Vector allfieldname = (Vector)pageContext.getAttribute("fieldnames");
  OvalCustomColumn column = new OvalCustomColumn(strLanguageCode);
  if(allfieldname == null)
    allfieldname = new Vector();

  String tabletype = request.getParameter("transtable");
  if(tabletype == null)
    tabletype = "";
%>
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" class="summary_top"></td>
  </tr>
  <tr>
    <td colspan="2"><img src="../../images/<%= strLanguageCode %>/quote.gif" width="16" height="11">
     <%= label.getLabelName("L_AddCondition") %><%= label.getLabelName("L_Colon") %></td>
  </tr>
</table>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <form name="condetailaddform" method="post" action="../../Dispatcher" target="_parent">
			   <input type="hidden" name="pagename" value="conditiondetailadd">
			   <input type="hidden" name="actionname">
				 <input type="hidden" name="datelastupdated" value="<%=JspHelper.filterNull( new java.sql.Date(new java.util.Date().getTime()) )%>">
         <input type="hidden" name="orgid" value="<%=JspHelper.filterNull( userInfo.get("orgid") )%>">
         <input type="hidden" name="conditionid" value="<%=JspHelper.filterNull( request.getParameter("conditionid") )%>">
         <input type="hidden" name="conditionidsession" value="<%=JspHelper.filterNull( request.getParameter("conditionid") )%>">
         <input type="hidden" name="conditiontype" value="<%=JspHelper.filterNull( request.getParameter("conditiontype") )%>">
         <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

  <tr>
    <td>
      <table width="100%" border="1" cellpadding="1" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr>
          <td class="need" width="74"><%= label.getLabelName("L_Sequence") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <input type="text" name="sortno"  size="15">
          </td>
        </tr>
        <tr>
          <td class="need"><%= label.getLabelName("L_FieldName") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <select name="fieldnamealias">
	              <option value="^">-----------</option>
			            <logic:iterate id="field" collection="<%= allfieldname %>">
			              <%
			                HashMap hm = (HashMap)pageContext.getAttribute("field");
			                String a_field = (String)hm.get("columnname");
			              %>
	              <option value = "<%=JspHelper.filterNull( a_field + "^" + hm.get("columntype") )%>" >
	                 <%=JspHelper.filterNull( (column.getColumnDesc(tabletype,a_field).length()!=0)?column.getColumnDesc(tabletype,a_field):a_field )%>
	              </option>
	              </logic:iterate>
	         </select>
	         <input type="hidden" name="fieldname">
          </td>
        </tr>
        <tr>
          <td class="need"><%= label.getLabelName("L_Operator") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <select name="operator">
              <option value="<" selected >&lt;</option>
              <option value="<>">&lt;&gt;</option>
              <option value=">">&gt;</option>
              <option value=">=">&gt;=</option>
              <option value="=">=</option>
              <option value="<=">&lt;=</option>
              <option value="like">like</option>
              <option value="not like">not like</option>
              <option value="is">is</option>
              <option value="is not">is not</option>
            </select>
          </td>
        </tr>
        <tr>
          <td class="need"><%= label.getLabelName("L_Value") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <input type="text" name="value0"  size="15">
            <input type="hidden" name="value"  size="15">
          </td>
        </tr>
        <tr>
          <td class="td-text"><%= label.getLabelName("L_Comment") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <input type="text" name="memo" size="70">
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
  <tr>
    <td class="td_center"><a onclick="page_done()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a></td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
 </form>
</table>
</body>
</html>


